#include<iostream>
#include<string>
#include<fstream>

using namespace std;
typedef struct contributor
{
    double number;
    string name;
}ctr;

int main()
{
    ifstream infile;
    infile.open("donators.txt");
    int i = 0;
    int frequency;
    infile >> frequency;
    ctr* c = new ctr[frequency];
    infile.get();
    for (int i = 0; i < frequency; i++)
    {
        getline(infile,c[i].name);
        infile >> c[i].number;
        infile.get();
    }
    int n = 1, m = 1;
    cout << "Grand Patrons:" << endl;
    for (int i = 0; i < frequency; i++)
    {
        if (c[i].number > 10000)
        {
            cout << c[i].name << "\t" << c[i].number << endl;
            n = 0;
        }
    }
    if (n)
        cout << "none.\n";
    cout << "Patrons:" << endl;
    for (int i = 0; i < frequency; i++)
    {
        if (c[i].number < 10000)
        {
            cout << c[i].name << "\t" << c[i].number << endl;
            m = 0;
        }
    }
    if (m)
        cout << "none.\n";
    delete[]c;
    infile.close();

    return 0;
}